<template>
	<view class="shipmentsList">
		<view class="shipmentsList-item"  v-for="item,index in deliveriesList" :key="item.id" @click="deliverDetails(item)">
			<view class="shipmentsList-item-train">
				<view>物流公司：{{item.logisticsCompany}}</view>
				<view :class="[item.status==0?'depart':'' || item.status==1?'distribution':'' || item.status==2?'distribution':'' || item.status==3?'signIn':'']">
					{{statusConvert(item.status)}}
				</view>
			</view>
			<view class="shipmentsList-item-train">
				<view>物流单号：{{item.logisticsNo}}</view>
			</view>
			<view class="shipmentsList-item-train">
				<view>发货人：{{item.sendUserName}}</view>
			</view>
			<view class="shipmentsList-item-train">
				<view>发货时间：{{item.sendTime}}</view>
				<view class="shipmentsList-item-train-inquire">物流查询</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deliveriesList:[]
			}
		},
		onLoad(option){
			let list = JSON.parse(decodeURIComponent(option.list))
			this.deliveriesList = list
		},
		methods:{
			statusConvert(type){
				switch (type) {
					case 0:
						return '已出库'
						break;
					case 1:
						return '配送中'
						break;
					case 2:
						return '待确认入库'
						break;
					case 3:
						return '已签收'
						break;
					default:
				}
			},
			deliverDetails(item){
				let data = {
					orderNo:item.orderNo,
					id:item.id
				}
				uni.navigateTo({
				    url: `/subcontractList/order/salesAdmin/salesOrder/deliverGoods/deliverDetails?data=${encodeURIComponent(JSON.stringify(data))}`
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.shipmentsList{
	min-height: 100vh;
	background-color: #eaeaea;
	padding: 20rpx;
	&-item{
		padding: 10rpx 20rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		&-train{
			line-height: 50rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			&-inquire{
				padding: 0 10rpx;
				border-radius: 12rpx;
				border: 1rpx solid #4169e1;
			}
			.depart{
				color: #FB3835;
			}
			.distribution{
				color: #FB882A;
			}
			.signIn{
				color: #63C05A;
			}
			
			
			
		}
	}
}	
</style>
